import Vue from 'vue'
import VueRouter from 'vue-router'
//导入Login组件
//import Login from "../components/Login.vue"
//Home组件
import Home from "../components/Home.vue"
//导入first组件
import First from "../components/First.vue"
//导入userlist组件
import userList from "../components/admin/userList.vue"

//导入rights组件
import rights from "../components/admin/rights.vue"

import Reg from '../components/Reg'
//身份验证
import Authentication from '../components/changepass/Authentication'
//修改密码
import Modifypass from '../components/changepass/Modifypass'
//成功
import ChangeSuccess from '../components/changepass/ChangeSuccess'


Vue.use(VueRouter)

//路由懒加载，提高响应速度
const Login = () => import("../components/Login");

//配置路由
const routes = [
  {
    path: "/",
    //重定向
    redirect:"/login"
  },
  {
    path: "/login",
    component: Login
  },
  //注册
  {
    path: "/reg",
    component: Reg
  },
  //身份校验
  {
    path: "/verify",
    component: Authentication
  },
  //修改密码
  {
    path: "/Modifypass",
    component: Modifypass
  },
  //成功
  {
    path: "/over",
    component: ChangeSuccess
  },
  {
    path: "/home",
    component: Home,
    redirect: "/first",
    children:[
      {path: "/first",component: First},
      {path:'/user', component: userList},
      {path:'/rights', component: rights}
    ],
  },
]

const router = new VueRouter({
  routes,
  mode: 'history'
})

export default router
